<%@page import="java.util.List"%>
<%@page import="classes.comment"%>
<%@page import="classes.AdminDB"%>
<%@page import="classes.user"%>
<%@page import="classes.product"%>
<%@page import="java.util.ArrayList"%>
<%ArrayList<product> productos = (ArrayList<product>) session.getAttribute("show");%>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="error.jsp" %>
<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Home | Alvaro´shop</title>
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

        <link href="shopStyles.css" rel="stylesheet" type="text/css"> <!-- guardamos el css en la raiz porque sino hay cosas que no funcionan -->
        <link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" type="text/css" href="css/style2.css" />




        <!-- Coloca esta petición de presentación donde creas oportuno. -->
        <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
        <script type="text/javascript">
            (function() {
                var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                po.src = 'https://apis.google.com/js/plusone.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
            })();
        </script>


        <script language="javascript" type="text/javascript" src="js/jquery.js"></script>
        <script language="javascript" type="text/javascript" src="js/jquery.easing.js"></script>
        <script language="javascript" type="text/javascript" src="js/script.js"></script>
        <script type="text/javascript">
            $(document).ready( function(){	
                var buttons = { previous:$('#jslidernews2 .button-previous') ,
                    next:$('#jslidernews2 .button-next') };			 
                $('#jslidernews2').lofJSidernews( { interval:5000,
                    easing:'easeInOutQuad',
                    duration:1200,
                    auto:true,
                    mainWidth:727,
                    mainHeight:300,
                    navigatorHeight		: 100,
                    navigatorWidth		: 310,
                    maxItemDisplay:4,
                    buttons:buttons } );						
            });

        </script>


        <!-- Pop out logout-->
        <script language="JavaScript">
            function Abrir_ventana (pagina) {
                var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=200, top=85, left=140";
                window.open(pagina,"",opciones);
            }
        </script>


        <!-- view shopping cart -->
        <script language=javascript>
            function setcookie (name,value,expires,path,domain,secure) {
                document.cookie = name + "=" + escape (value) +
                    ((expires) ? "; expires=" + expires.toGMTString() : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
            }

            function getcookieval (offset) {
                var endstr = document.cookie.indexOf (";", offset);
                if (endstr == -1)
                    endstr = document.cookie.length;
                return unescape(document.cookie.substring(offset, endstr));
            }

            function getcookie (name) {
                var arg = name + "=";
                var alen = arg.length;
                var clen = document.cookie.length;
                var i = 0;
                while (i < clen)
                {
                    var j = i + alen;
                    if (document.cookie.substring(i, j) == arg) return getcookieval (j);
                    i = document.cookie.indexOf(" ", i) + 1;
                    if (i == 0) break;
                }
                return null;
            }
            /* Manejo del dinero*/
            function money(input) {
                var euros = Math.floor(input)
                var tmp = new String(input)
                for (var decimalAt = 0; decimalAt < tmp.length; decimalAt++) {
                    if (tmp.charAt(decimalAt)==".")
                        break;
                }
                var centimos  = "" + Math.round(input * 100)
                centimos = centimos.substring(centimos.length-2, centimos.length)
                euros += ((tmp.charAt(decimalAt+2)=="9")&&(centimos=="00"))? 1 : 0;

                return euros + "." + centimos
            }

            /*quitar items del carrito*/
            function remove(RemOrder) {
                if (confirm("This product will be removed! Sure?")) {
                    numerodeorden = getcookie("order");
                    for(i=RemOrder; i < numerodeorden; i++) {
                        nuevopedido1 = "Order." + (i+1);
                        nuevopedido2 = "Order." + (i);
                        datos = getcookie(nuevopedido1);
                        setcookie (nuevopedido2, datos, null, "/");
                    }
                    nuevopedido = "Order." + numerodeorden;
                    setcookie ("order", numerodeorden-1, null, "/");
                    deletecookie(nuevopedido,"/");
                    location.href=location.href;
                }
            }

            function viewcart() {
                numerodeorden = 0;
                subtotal=0;
                preciototal=0;
                numerodeorden = getcookie("order");
                tablas = "";
                for (i = 1; i <= numerodeorden; i++) {
                    nuevopedido = "Order." + i;
                    datos = "";
                    datos = getcookie(nuevopedido);
                    ficha0 = datos.indexOf("|", 0);
                    ficha1 = datos.indexOf("|", ficha0+1);
                    ficha2 = datos.indexOf("|", ficha1+1);
                    campos = new Array;
                    campos[0] = datos.substring( 0, ficha0 );
                    campos[1] = datos.substring( ficha0+1, ficha1 );
                    campos[2] = datos.substring( ficha1+1, ficha2 );
                    campos[3] = datos.substring( ficha2+1, datos.length );
                    subtotal = subtotal + (campos[1] * campos[0]);
                    preciototal = money(subtotal);
                    tablas += "<tr style='font: 9pt; text-align: justify; color=white;'><td  style='color=navy'>"
                        + "<strong>Product: </strong>" + campos[3] + " <strong>Price: </strong> " + campos[1]
                        + " €</td>"
                        + "<td><img src=\"images/remove.png\" width=\"20\" height=\"20\" border=\"0\" alt=\"\" onClick=\"remove("+i+")\">"

                        + "<input type=hidden name=\"Producto"+ i +"\" value=\"" + campos[3] + "\">"
                        + "<input type=hidden name=\"Euros"+ i +"\" value=\"" + campos[1] + "\">";

                }
                document.write(tablas);
                document.write("</td></tr><tr><td style='color:white'>");
            }

            function deletecookie(name, path, domain) {
                if (getcookie(name)) {
                    document.cookie = name + "=" + 
                        ((path) ? "; path=" + path : "") +
                        ((domain) ? "; domain=" + domain : "") +
                        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
                }
            }

            function about()
            {
                alert("Aplicacion realizada por:\nAlvaro Garcia Ojea\n5º Ingenieria informatica.\n\nEmail: alvarogarcia9@gmail.com");
            }


            function accesoAdmin()
            {
                var text;
                text = prompt("Admin password please: ");
                if(text == null || text=="")
                {
                    return
                }
                if(text=="admin")
                {
                    location.href = "Admin/Admin.jsp"	
                }
                else
                {
                    alert("Wrong password!");	
                }
            }
            
            
            function comprobarTexto(texto)
            {
                if(texto != "")
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            

    
            function validarRegistro(){
                with(document.signup){
                    //Comprobar datos
                    if(!comprobarTexto(name.value)){
                        alert("Name is empty");
                        name.focus();
                    }
                    else if(!comprobarTexto(comment.value)){
                        alert("Comment is empty");
                        comment.focus();
                    }
                    else{
                        submit();
                    }
                    
                }
            }
        </script>

    </script>



    <!-- maxItemDisplay: 3, eso es lo normal -->

    <style>

        ul.lof-main-wapper li {
            position:relative;	
        }
        body {
            background-image: url();
            background-repeat: no-repeat;
        }
    </style>

</head>

<body>




    <div id="fb-root"></div>
    <div align="center">
        <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/es_ES/all.js#xfbml=1";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

    </div>




    <div class="container">
        <div class="header">

            <div align="center">
                <table width="100%" border="0">
                    <tr>
                        <td><img src="images/logoshop2.png" width="410" height="165" alt="shop"></td>
                        <td align="right"><img src="images/flag copia.png" width="149" height="123" alt="yourf1store">
                            <!-- Boton me gusta de facebook -->
                            <div class="fb-like" data-send="true" data-layout="button_count" data-width="100" alignt="right" data-show-faces="true"></div>



                            <%-- IDENTIFIACION DE USUARIO CON SESIONES O COOKIES --%>

                            <%@ page language="java" %>
                            <%
                                String cookieName = "email";
                                Cookie cookies[] = request.getCookies();

                                Cookie email = null;
                                if (cookies != null) {
                                    for (int i = 0; i < cookies.length; i++) {
                                        if (cookies[i].getName().equals(cookieName)) {
                                            email = cookies[i];

                                            break;
                                        }
                                    }
                                    //if(email == null)
                                    //response.sendRedirect("unknownUser.jsp");

                                }

                            %>


                      <%
                                String cookie = "name";
                                Cookie cookies2[] = request.getCookies();

                                Cookie name = null;
                                if (cookies2 != null) {
                                    for (int i = 0; i < cookies2.length; i++) {
                                        if (cookies2[i].getName().equals(cookie)) {
                                            name = cookies2[i];

                                            break;
                                        }
                                    }
                                    //if(email == null)
                                    //response.sendRedirect("unknownUser.jsp");

                                }

                            %>


                            <!-- SiteSearch Google -->
                            <FORM method="get" action="http://www.google.com/search">
                                <input type=hidden name=ie value=UTF-8>
                                <input type=hidden name=oe value=UTF-8>
                                <TABLE bgcolor="#F27405" class="borderSearchRightDown"><tr>
                                        <td class="borderSearchRightDown">
                                            <INPUT TYPE="search" name="q" size="31" maxlength="255" value="" placeholder="Search something you want...">
                                            <INPUT type="submit" name="btnG" VALUE="Buscar en sitio">
                                            <font size=-1>
                                            <input type="hidden" name="domains" value="index.jsp"><br><input type="radio" name="sitesearch" value=""> 
                                            <span class="fontSpecial">WWW</span>
                                            <input type="radio" name="sitesearch" value="index.jsp" checked>
                                            <span class="fontSpecial">F1 store</span><br>
                                            </font>

                                        </td></tr></TABLE>
                                <div align="right">
                                    <!-- Reconocimiento de usuario -->


                                    <label><strong><%if (email != null) {%><%=email.getValue()%></strong> | <a href="javascript:Abrir_ventana('logout_popup.jsp')"><font size="1" face="Verdana">logout</font></a> </label>
                                    <label> | <a href="options.jsp"><font size="1" face="Verdana">options</font></a></label> 
                                            <%} else {

                                            %>
                                    <label><strong> Unknown user |</strong></label> <a href="login.jsp">Login</a>
                                    <%}%>

                                    <!-- Fin reconocimiento del usuario -->       



                                    <img src="images/eng.gif" width="20" height="15" alt="eng">   
                                    <img src="images/esp.gif" width="20" height="15" alt="esp">
                                    <img src="images/fra.gif" width="20" height="15" alt="fra"> 
                                    <img src="images/ger.gif" width="20" height="15"> 
                                    <img src="images/por.gif" width="20" height="15" alt="por"> 
                                    <a href="#final" class="fontSpecialLanguageChooser"><font size="1" face="Verdana">Choose language</font></a></div>
                            </FORM>

                    </tr>
                </table>

            </div>
        </div>
    </div>
    <div class="container">
        <div class="header">
            <div align="center">
                <ul class="menu">    
                    <li><a href="index.jsp" class="active"><span>Home</span></a></li>
                    <% if (email == null) {
                    %>

                    <li><a href="login.jsp"><span>Login</span></a></li>
                    <li><a href="signup.jsp"><span>Signup</span></a></li>

                    <%} else {%>
                    <li><a href="logout_popup.jsp"><span>Logout</span></a></li>
                    <li><a href="options.jsp"><span>Options</span></a></li>

                    <%}%>       
                    <li onClick="about()"><a href="#"><span>About</span></a></li>
                    <li><a href="contact.jsp"><span>Contact</span></a></li>
                    <li><a href="cars.jsp"><span>Cars</span></a></li>
                    <li><a href="apparel.jsp"><span>Apparel</span></a></li>
                    <li><a href="gadgets.jsp"><span>Gadgets</span></a></li>
                    <li><a href="/CarAccessories"><span>Car Accesories</span></a></li>
                    <li><a href="search.jsp"><span>Search</span></a></li>
                    <li><a href="Scart.jsp"><span>Cart</span></a></li>

                </ul>

            </div>
        </div>
    </div>

    <div class="container">
        <div class="content">


            <div align="center">

                <!------------------------------------- THE CONTENT ------------------------------------------------->
            </div>
            <div id="jslidernews2" class="lof-slidecontent" style="width:100%; height:300px;"> 
                <div align="center"><!-- lo normal son width: 980px; -->
                </div>
                <div class="preload">
                    <div>

                    </div>

                </div>


                <div class="button-previous">
                    <div align="center">Previous</div>
                </div>

                <div align="center">
                    <!-- MAIN CONTENT --> 
                </div>
                <div class="main-slider-content" style="width:684px; height:400px;">
                    <div align="right">
                        <!--<ul class="sliders-wrap-inner">
                            <li>	                      
                                <img src="images/thumbl_980x340.png" title="F1 Cars" >           
                            </li>
                        </ul>-->
                    </div>
                    <ul class="sliders-wrap-inner">
                        <li>
                            <div align="center"><img src="images/thumbl_980x340.png" title="You choose" >           
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="F1 Cars" href="#Category-1">/ Cars - Ferrari, RDR, Mercedes... /</a> <i> — Wednesday, February 2, 2012</i>	                      </div>
                                </div>
                                <h4 align="left">Our cars</h4>
                                <p align="left">We offer a selection of the best formula 1 cars
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 
                        <li>
                            <div align="center"><img src="images/thumbl_980x340_002.png" title="You choose" >           
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="You choose" href="#Category-2">/  You choose: new, km 0, used, second hand /</a> 	<i> — Wednesday, February 2, 2012</i></div>
                                </div>
                                <h4 align="left"> You are are the owner, you choose</h4>
                                <p align="left">In Alvaro F1 Store you can buy the car you need!
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 
                        <li>
                            <div align="center"><img src="images/thumbl_980x340_003.png" title="Pay in 12 months" >            
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="Pay in 12 months" href="#Category-3">/  Pay in 12 months without interest /</a> 	<i>  — Wednesday, February 2, 2012</i></div>
                                </div>
                                <h4 align="left">Customize your plan</h4>
                                <p align="left">You can pay easily
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 
                        <li>
                            <div align="center"><img src="images/thumbl_980x340_004.png" title="HRT" >            
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="HRT" href="#Category-4">/ Hispania Racing Team /</a>	<i>  — Wednesday, February 2, 2012</i></div>
                                </div>
                                <h4 align="left">We are the official HRT store</h4>
                                <p align="left">All HRT products!!! Here you will find everything you want!
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 
                        <li>
                            <div align="center"><img src="images/thumbl_980x340_005.png" title="Merchandising" >            
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="Merchandising" href="#">/ Merchandising /</a>	<i> — Wednesday, February 2, 2012</i></div>
                                </div>
                                <h4 align="left">Caps, Shirts, Jackets...</h4>
                                <p align="left">Clothes and accessories for all teams!
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 
                        <li>

                            <div align="center"><img src="images/thumbl_980x340_006.png" title="Payment System" >            
                            </div>
                            <div class="slider-description">
                                <div class="slider-meta">
                                    <div align="left"><a target="_parent" title="Payment System" href="#">/ Paypal, credit card, transfer /</a>	<i>  — Wednesday, February 2, 2012</i></div>
                                </div>
                                <h4 align="left">Payment method</h4>
                                <p align="left">Our Payment System accepts paypal, credit card and transfers
                                    <a class="readmore" href="#">Read more </a>
                                </p>
                            </div>
                        </li> 

                    </ul>  	
                </div>
                <div align="center"><!-- END MAIN CONTENT --> 
                    <!-- NAVIGATOR -->
                </div>
                <div class="navigator-content">
                    <div class="navigator-wrapper">
                        <div align="center">
                            <ul class="navigator-wrap-inner">
                                <li> </li>
                            </ul>
                        </div>
                        <ul class="navigator-wrap-inner">
                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/1.jpg" />
                                    </div>
                                    <h3 align="left"> Our cars, fantastic!!!</h3>
                                    <div align="left"><span>2012</span> - We have the newest cars: Ferrari, Williams, RBR, Lotus, Mercedes, McClaren...
                                    </div>
                                </div>    
                            </li>
                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/2.jpg" />
                                    </div>
                                    <h3 align="left">  You choose: new, km 0, used, second hand  </h3>
                                    <div align="left"><span>2012</span> - In our store you can find a lot of kinds of cars
                                    </div>
                                </div>    
                            </li>

                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/3.jpg" />
                                    </div>
                                    <h3 align="left">  Pay in 12 months without interest </h3>
                                    <div align="left"><span>2012</span> - Don`t worry!!! You can pay in 12 months!!
                                    </div>
                                </div>     
                            </li>

                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/4.jpg" />
                                    </div>
                                    <h3 align="left"> Hispania Racing Team</h3>
                                    <div align="left"><span>2012</span> - Cars, clothes, toys... all of HRT!
                                    </div>
                                </div>
                            </li>    
                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/5.jpg" />
                                    </div>
                                    <h3 align="left"> Merchandising </h3>
                                    <div align="left"><span>2012</span> - Merchandising: Ferrari, Williams, McClaren, Mercedes, Renault...
                                    </div>
                                </div>   
                            </li>
                            <li>
                                <div>
                                    <div align="center"><img src="images/lofthumbs/6.jpg" />
                                    </div>
                                    <h3 align="left"> Payment Method</h3>
                                    <div align="left"><span>2012</span> - Paypal, Credit card - visa, mastercard, american express -, Transfers
                                    </div>
                                </div>
                            </li>     		
                        </ul>
                    </div>

                </div> 
                <div align="center"><!----------------- END OF NAVIGATOR --------------------->
                </div>
                <div class="button-next">
                    <div align="center"></div>
                </div>

                <div align="center">
                    <!-- BUTTON PLAY-STOP -->
                </div>
                <!--<div class="button-control">
                <div align="center"><span></span></div>
                </div>-->
                <div align="center"><!-- END OF BUTTON PLAY-STOP -->

                </div>
            </div> 

            <div align="center">
                <!------------------------------------- END OF THE CONTENT ------------------------------------------------->

            </div>
        </div>
        <div align="center">
            <table width="100%" height="226" border="0">
                <tr>
                    <td width="14%" align="center" valign="top" class="fontSpecial"><div align="left">
                            Categories | <a href="allproducts.jsp">All products</a>
                            <ul id="MenuBar1" class="MenuBarVertical">
                                <li><a href="cars.jsp" class="MenuBarItemSubmenu">Cars</a>
                                    <ul>
                                        <li><a href="ferrari.jsp">Ferrari</a></li>
                                        <li><a href="redbull.jsp">Red Bull Racing</a></li>
                                        <li><a href="mcclaren.jsp">McClaren-Mercedes</a></li>
                                        <li><a href="mercedes.jsp">Mercedes</a></li>
                                        <li><a href="williams.jsp">Williams-Cosworth</a></li>
                                        <li><a href="tororosso.jsp">Toro Rosso</a></li>
                                        <li><a href="renault.jsp">Renault</a></li>
                                        <li><a href="forceindia.jsp">Force India-Mercedes</a></li>
                                        <li><a href="sauber.jsp">Sauber</a></li>
                                        <li><a href="lotus.jsp">Lotus-Renault</a></li>
                                        <li><a href="hispania.jsp">Hispania RT</a></li>
                                        <li><a href="virgin.jsp">Virgin</a></li>
                                    </ul>
                                </li>
                                <li><a href="apparel.jsp" class="MenuBarItemSubmenu">Apparel</a>
                                    <ul>
                                        <li><a href="shirts.jsp">Shirts</a></li>
                                        <li><a href="jackets.jsp">Jackets</a></li>
                                        <li><a href="pants.jsp">Pants</a></li>
                                        <li><a href="underware.jsp">Underware</a></li>
                                        <li><a href="sneakers.jsp">Sneakers</a></li>
                                    </ul>
                                </li>
                                <li><a href="gadgets.jsp">Gadgets</a>	          </li>
                                <li><a href="caraccessories.jsp" class="MenuBarItemSubmenu">Car accessories</a>
                                    <ul>
                                        <li><a href="lights.jsp">Lights</a></li>
                                        <li><a href="tyres.jsp">Tyres</a></li>
                                        <li><a href="wheel.jsp">Steering wheel</a></li>
                                        <li><a href="others.jsp">Other pieces</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>

                        <p>&nbsp;</p>
                        <h4><img src="images/shoplogo.png" width="27" height="23" alt="shoppingcart">Shopping Cart</h4>
                        <table width="146" align="center" cellpadding="5" cellspacing="1" class="shoopingcartINDEX" bgcolor="#F27405" style="font: 10pt Verdana, Geneva, Arial, Helvetica, sans-serif;">
                            <tbody>

                            <script language=JavaScript>
                            viewcart();
                            </script>
                            <tr><a href="Scart.jsp">view cart</a></tr>
                </tbody>
            </table>

            <img src="images/makemonet.png" width="108" height="212" alt="money">

            <!-- Beginning of meebo me widget code.
    Want to talk with visitors on your page?  
    Go to http://www.meebome.com/ and get your widget! -->
            <embed src="http://widget.meebo.com/mm.swf?BRqynkBnZM" type="application/x-shockwave-flash" width="150" height="300"></embed>





            </td>
            <td width="86%" align="right" valign="top" class="borderContent">
                <p>
                    <img src="images/Goldstar copia.png" alt="store ranking" width="160" height="160" align="bottom">
                    <a href="ferrariOpportunities.jsp">
                        <img src="images/ferrari sale.png" alt="ferrari opportunities" width="317" height="196" class="borderImages">
                    </a>
                    <a href="williamssale.jsp">
                        <img src="images/williams_sale.png" alt="williams sale" width="311" height="196" class="borderImages">
                    </a>
                </p>
                <h3>
                    <p align="center">What do you wanna see?</p>
                </h3>

                <form name="searchIndex" method="post" action="/ShopOnline/searchIndex">
                    <div align="center">
                        <table width="60%" border="0" class="popup">
                            <tr>
                                <td width="67%" align="right" valign="top"><table width="100%" border="0">
                                        <tr>
                                            <td width="53%">
                                                <div align="center">Show
                                                    <select name="by" id="by">
                                                        <option value="Cheapest">Cheapest</option>
                                                        <option value="Most expensive">Most expensive</option>
                                                        <option value="Bestsellers">Bestsellers</option>
                                                        <option value="2012">2012 Cars</option>
                                                        <option value="2011">2011 Cars</option>
                                                        <option value="2010">2010 Cars</option>
                                                        <option value="2009">2009 Cars</option>
                                                    </select>
                                                    <input type="submit" name="go" id="go" value="GO!">

                                                </div>
                                            </td>
                                        </tr>
                                    </table></td>
                            </tr>
                        </table>
                    </div>
                </form>
                <h3>&nbsp;</h3>
                <div>
                    <!-- Div para imprimir los resultados-->
                    <div align="center">
                        <%
                            if (productos == null) {%>
                        <label><img src="images/lists.png"></label>
                        <%} else {
                                for (product cl : productos) {%>
                        <table>
                            <tr>
                                <td width="59"><label><strong>Team:</strong> <%=cl.getTeam()%></label></td>
                                <td width="62"><label><strong>Name: </strong><%=cl.getName()%></label></td>
                                <td width="103"><label><strong>Description: </strong><%=cl.getDescription()%></label></td>
                                <td width="42"><label><strong>Stock:</strong> <%=cl.getStock()%></label></td>
                                <td width="80"><label class="tableComments"><%=cl.getPrice()%> € </label></td>
                                <td width="32"><label><strong>Sold: </strong><%= cl.getPurchasedtimes()%> times</label></td>
                                <td width="258"><img src="<%=cl.getDir()%>" alt="photo" width="250" height="150" class="borderImages"></td>
                            </tr>
                        </table>
                        <%}
                            }%>
                    </div>
                </div><!-- Div para imprimir los resultados-->  




                <h3><p align="center">&nbsp;</p>
                    <p align="center"><img src="images/comentario.png" width="27" height="27" alt="comment">User Comments</p>
                </h3>
                <table width="99%" align="center" class="borderContentBestSellers">
                    <tr><td width="90%" align="center">

                            <form name="signup" method="post" action="/ShopOnline/comment_process1">
                                <div align="center">
                                    <table width="50%" border="0">
                                        <tr>
                                            <td><div align="right"><span class="fontSpecial">Name/Email</span></div></td>
                                            <td><span class="fontSpecial">
                                                    <input type="text" name="name" id="name" placeholder="Your name/email" required>
                                                </span></td>
                                        </tr>
                                        <tr>
                                            <td><div align="right"><span class="fontSpecial">
                                                    </span></div>                  <span class="fontSpecial">
                                                    <label for="comment">
                                                        <div align="right">Comment:</div>
                                                    </label>
                                                </span></td>
                                            <td><span class="fontSpecial">
                                                    <textarea maxlength="255" class="enterComment" name="comment" cols="30" rows="5" id="comment" placeholder="Your comment please!" required="required"></textarea>
                                                </span></td>
                                        </tr>
                                    </table>
                                    <p>
                                        <input type="button" name="validad" id="validar" value="Send" onclick="validarRegistro()">
                                        <input type="hidden" name="product" value="index">
                                    </p>
                                </div>
                            </form>

                        </td></tr>


                </table>


                <h3 align="center">View user comments</h3>
                <form action="/ShopOnline/listComments" method="post">
                    <div align="center">
                        <input type="hidden" value="comments" name="comments">
                        <input type="hidden" value="index" name="product">
                        <input type="submit" value="View">
                    </div>
                </form>

                <div align="center">
                    <%
                        AdminDB adb = new AdminDB();
                        comment com = new comment();
                        List<comment> comentarios = null;




                        comentarios = com.getAllComentarios(adb.getConnection(), "index");//Lista los comentarios generales

                        if (comentarios == null) {%>
                    <label>
                        There are no comments!
                    </label>       
                    <%} else {
                        for (comment cl : comentarios) {%>
                    <table width="373">
                        <tr>
                            <td width="173"><label>
                                    <div align="left"><strong><%=cl.getName()%> says:
                                            </label>
                                        </strong> </div></td>
                        </tr>
                        <tr>
                            <td class="popup"><label>
                                    <div align="left"><%=cl.getComment()%>
                                        <% if (email != null && name != null) {
                                                if (email.getValue().contentEquals(cl.getName()) || cl.getName().contentEquals(name.getValue())) {%>


                                        <form action="/ShopOnline/deleteComment" name="deleteComment" method="post">
                                            <div align="right">
                                              <input type="hidden" name="id" value="<%=cl.getId()%>">
                                              <input type="image" name="delete" src="images/remove.png" />
                                            </div>
                                        </form>
                                        <%} else {%>
                                        <label></label>
                                        <%}
                                            }%>


                                    </div></td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                    <%}
                        }%>
                </div>
                <p align="center">&nbsp;</p>
                <p align="center">&nbsp; </p>
                </tr>
                </table>

        </div>
    </div>
    <div align="center">
    </div>



</div>
<div class="container">
    <div class="footer">
        <h5 align="center" class="white">Alvaro F1 online shop - Your F1 store - <a href="javascript:void(0)" onClick="accesoAdmin()">Admin</a></h5>
        <div align="center"><a name="final"></a><!-- Marcador para ir al final de la pagina -->
        </div>
        <div id="google_translate_element" align="center"></div>
        <div align="center">
            <script>
            function googleTranslateElementInit() {
                new google.translate.TranslateElement({
                    pageLanguage: 'es'
                }, 'google_translate_element');
            }
            </script>
            <script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>
        <div align="center"><img src="images/footerShop.png" width="940" height="74" alt="footer"></div>
    </div>
</div>

<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>